package com.wanbangee.marksystem.service.imp;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wanbangee.marksystem.dao.StatisticsSubReportDao;
import com.wanbangee.marksystem.entities.StatisticsSubReport;
import com.wanbangee.marksystem.service.StatisticsSubReportService;

@Service
public class StatisticsSubReportServiceImp implements StatisticsSubReportService {
	@Autowired
	public StatisticsSubReportDao statisticsSubReportDao;

	@Override
	public List<StatisticsSubReport> slectSubjectReportByExamIdAndSubIdAndClaIdAndstuNmOrStuNo(Integer examId,
			Integer subId, Integer claId, String stuNmOrStuNo) {
		if(examId ==-1 ||subId == -1) {
			System.out.println("0");
			return null;
		}else if(claId == -1){
			System.out.println("1");
			return this.statisticsSubReportDao.slectSubjectReportByExamIdAndSubId(examId, subId);
		}else if(stuNmOrStuNo == null || "".equals(stuNmOrStuNo)) {
			System.out.println("2");
			return this.statisticsSubReportDao.slectSubjectReportByExamIdAndSubIdAndClaId(examId, subId, claId);
		}else {
			System.out.println("3");
			return this.statisticsSubReportDao.slectSubjectReportByExamIdAndSubIdAndClaIdAndstuNmOrStuNo(examId, subId, claId, "%"+stuNmOrStuNo+"%");
		}
	}

}
